FreeImage_SaveJPG
FreeImage_SaveJPG Filename$, ImageIndex, [CompressionQuality =1]
 
Parameters:

    Filename$ = The name and path of the output file
    ImageIndex = The Index of the image you wish to save
    [CompressionQuality =1] = The quality of the saved image. Ranges from 0 (Best) to 4 (worst)
Returns: NONE
 

      The FreeImage_SaveJPG function uses the FreeImage library to save an image out to disc in JPG format. The saver has an optional compression quality parameter so you select how much quality loss you want in your saved picture.

     Valid Compression Quality Parameter:

00 = Best
01 = Good
02 = Normal
03 = Average
04 = Poor


      The saver gives us a selection of quality modes for the saved picture. JPG is a lossy compression format remember, so the lower the quality you pick, the smaller the file sizes, but the less accurate those pictures are going to be.




FACTS:


      * None




Mini Tutorial:


      This example includes the library, create a gradient image then saves it out to disk.


  
  
  // include the Free Image library
  #Include "FreeImage"
  
  
  // Make an image with a gradient on it for something to save
  ThisImage=NewImage(800,600,2)
  RenderToImage ThisImage
  ShadeBox 0,0,800,600,$FF,$FF00,$112233,$FF4400
  RenderToScreen
  DrawImage ThisIMage,0,0,false
  
  
  
  // save name of file
  Filename$="C:\Saved_Image.jpg"
  
  
  For lp =0 To 4
     
   ; compute name of output with different compression
   ; modes
     SaveName$=Replace$(FileName$,".",Str$(lp)+"."     )
     
   ; display the name of the save file
     Print SAveName$
     
     
   ; save this image as a file
     FreeImage_SaveJPG(SaveName$,ThisImage, lp)
     
   ; check if the file saved,  as windows may prevent it
   ; from saving to the C:  drive
     If FileExist(SaveName$)
        
      ; Display the size of the file
        Print "Size:"+Str$(FileSize(SaveName$))
     EndIf
     
  Next
  
  
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  
  
  




 
Related Info: FreeImage_LoadImage | FreeImage_SaveBMP | FreeImage_SavePNG | LoadImage :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com